package com.gxa.customer.service.Impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gxa.common.commons.R;
import com.gxa.common.pojo.Country;
import com.gxa.customer.mapper.CountryMapper;
import com.gxa.customer.service.CountryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CountryServiceImpl extends ServiceImpl<CountryMapper, Country> implements CountryService {

    @Autowired
    private CountryMapper countryMapper;

    //查询所有国家
    @Override
    public R selectAllCountry() {
        R r = new R();
        List<Country> countryList = countryMapper.selectList(null);
        if (countryList == null) {
            r.setCode(500);
            r.setMsg("无数据！！");
            return r;
        } else {
            r.setCode(200);
            r.setMsg("查询成功！");
            r.setData(countryList);
            return r;
        }
    }

}
